function getNowFormatDate(val) {
    const date = new Date(Date.parse(val));

    var month = date.getMonth() + 1; //月份处理
    var day = date.getDate();
    month = (month < 10) ? ('0' + month) : month;//月份为1-9月,在其前面加0
    day = (day < 10) ? ("0" + day) : day;//日期为1-9号,在其前面加了0
    var s1 = "-";//定义年月日分隔符-
    var s2 = ":";//定义时分秒分隔符:
    var d = date.getMinutes();
    var h = date.getHours();
    h = (h < 10) ? ("0" + h) : h;//日期为1-9号,在其前面加了0
    d = (d < 10) ? ("0" + d) : d;//日期为1-9号,在其前面加了0
    //date.getMinutes() = (date.getMinutes() < 10) ? ('0' + date.getMinutes()) : date.getMinutes();//月份为1-9月,在其前面加0
    //拼接年月日,时分秒
    var currDate = h + s2 + d
    return currDate;
}
function formattedDate(val) {
    const date = new Date(Date.parse(val));
    const formattedDate = date.toLocaleString();
    return formattedDate;

}
function formattedAqi(val) {
    if (val <= 50) {
        return "优";
    } else if (val > 51 && val <= 100) {
        return "良";
    } else if (val > 101 && val <= 150) {
        return "轻度污染";
    } else if (val > 151 && val <= 200) {
        return "中度污染";
    } else if (val > 201 && val <= 300) {
        return "重度污染";
    } else if (val > 301 && val <= 500) {
        return "严重污染";
    }

}
function fotmatDescription(val) {
    if (val == "0") {
        return "系统报警"
    } else if (val == "1") {
        return "常规报警"
    } else if (val == "2") {
        return "一般报警"
    } else {
        return "紧急报警" 
    }
}
function formatTime(time) {
    const now = new Date(time);
    const year = now.getFullYear();
    const month = ('0' + (now.getMonth() + 1)).slice(-2);
    const day = ('0' + now.getDate()).slice(-2);
    const hours = ('0' + now.getHours()).slice(-2);
    const minutes = ('0' + now.getMinutes()).slice(-2);
    const seconds = ('0' + now.getSeconds()).slice(-2);

    const formattedTime = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
    return formattedTime;

}